/*public class text8 {
    public boolean isSymmetric(TreeNode root) {
        if(root==null)
        {
            return true;
        }


        return isSymmetric(root.left,root.right);



    }
    public boolean isSymmetric(TreeNode root1,TreeNode root2)
    {
        if(root1==null&&root2!=null||root2==null&&root1!=null)
        {
            return false;
        }
        if(root1==null&&root2==null)
        {
            return true;
        }
        if(root1.val!=root2.val)
        {
            return false;
        }
        return isSymmetric(root1.left,root2.right)&&isSymmetric(root1.right,root2.left);




    }
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if(p==null&&q==null)
        {
            return true;
        }
        if(p==null&&q!=null||p!=null&&q==null)
        {
            return false;
        }
        if(p.val!=q.val)
        {
            return false;
        }
        if(!isSameTree(p.left,q.left))
        {
            return false;
        }
        if(!isSameTree(p.right,q.right))
        {
            return false;
        }
        return true;

    }
    public TreeNode invertTree(TreeNode root) {
        if(root==null)
        {
            return null;
        }
        TreeNode a =root.left;
        root.left=root.right;
        root.right=a;
        invertTree(root.left);
        invertTree(root.right);
        return root;


    }
    public boolean isBalanced(TreeNode root) {
        if(root==null)
        {
            return true;
        }
        int d=getHeight(root.left);
        int f=getHeight(root.right);
        if(Math.abs(d-f)<=1&&isBalanced(root.left)&&isBalanced(root.right))
        {
            return true;
        }
        return false;


    }
    public int getHeight(TreeNode a)
    {
        if(a==null)
        {
            return 0;
        }
        int b=getHeight(a.left);
        int c=getHeight(a.right);
        return b>c?b+1:c+1;

    }

 */
